package com.wehealth.adapter;

import com.wehealth.R;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Adapter_PlanDay_info_new extends BaseAdapter {

	/**
	 * 上下文
	 */
	private Context ctx;
	/**
	 * 列表数据
	 */
	private String[] theFoodNames;
	private String[]  theFoodEnergy;
	private String[]  theFoodWeights;
	
	public Adapter_PlanDay_info_new(Context ctx,String[]  theFoodNames,
			String[]  theFoodEnergy,String[]  theFoodWeights){
		this.ctx = ctx;
		this.theFoodNames = theFoodNames;
		this.theFoodEnergy = theFoodEnergy;
		this.theFoodWeights = theFoodWeights;
	}

	@Override
	public int getCount() {
		return theFoodNames.length;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int index, View convertView, ViewGroup arg2) {
		
		View view = LayoutInflater.from(ctx).inflate(R.layout.plan_day_info_list_item,null);
		TextView info_name = (TextView)view.findViewById(R.id.info_name);
		Log.d("SIMMON","  info_name= "+ info_name);
		info_name.setText(theFoodNames[index]);
		TextView info_value = (TextView)view.findViewById(R.id.info_value);
		String value = theFoodEnergy[index]+" 卡  |  "+theFoodWeights[index]+" 克";
		Log.d("SIMMON","  value= "+ value);
		info_value.setText(value);
		return view;
	}

}